<?php

namespace App\Http\Controllers;

use App\Datatables;
use App\JkblShanghuWithdraw;
use Illuminate\Http\Request;

/**
 * Class ShanghuWithdrawController
 * @package App\Http\Controllers
 */
class ShanghuWithdrawController extends Controller
{
    /**
     * ShanghuWithdrawController constructor.
     */
    public function __construct()
    {
        $this->middleware('auth');
    }

    /**
     * 商户提现列表
     * @param Request $request
     * @return \Illuminate\Contracts\View\Factory|\Illuminate\Http\JsonResponse|\Illuminate\View\View
     */
    public function withdrawList(Request $request)
    {
        if ($request->isMethod('post')) {
            return response()->json(Datatables::ShanghuWithdrawList());
        }

        return view('shanghuWithdraw.withdrawList');
    }

    /**
     * 提现通过
     * @param JkblShanghuWithdraw $jkblShanghuWithdraw
     * @return array|\Exception
     * @throws \Exception
     */
    public function withdrawDone(JkblShanghuWithdraw $jkblShanghuWithdraw)
    {
        return JkblShanghuWithdraw::WithdrawDone($jkblShanghuWithdraw);
    }


    /**
     * 提现不通过
     * @param JkblShanghuWithdraw $jkblShanghuWithdraw
     * @return array|\Exception
     * @throws \Exception
     */
    public function withdrawNo(JkblShanghuWithdraw $jkblShanghuWithdraw, Request $request)
    {
        return JkblShanghuWithdraw::WithdrawNo($jkblShanghuWithdraw, $request);
    }
}
